
package com.huaweicloud.haydn.delivercore.agent.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 功能描述
 *
 * @since 2023-03-29
 */
@Component
@Data
@Slf4j
public class ObsAgencyConfig {
    @Value("${iam.domainName}")
    private String domainName;

    @Value("${iam.agencyName}")
    String agencyName;

    @Value("${obs.bucketName}")
    private String bucketName;

    @Value("${obs.dirs}")
    private String dirs;

    @Value("${ak}")
    private String ak;

    @Value("${sk}")
    private String sk;

    @Value("${endPoint}")
    private String obsEndPoint;

    public boolean isvalid() {
        if (StringUtils.isBlank(ak) || StringUtils.isBlank(sk)) {
            log.error("ak,sk is missing");
            return false;
        }
        if (StringUtils.isBlank(obsEndPoint) || StringUtils.isBlank(domainName) || StringUtils.isBlank(bucketName)) {
            log.error("endPoint,domainName,bucketName is missing");
            return false;
        }
        return true;
    }
}
